<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline">
        <a-row :gutter="24">
          <
          <a-col :xl="5" :lg="9" :md="10" :sm="24">
            <a-form-item label="班级">
              <j-select-banji v-model="queryParam.bjid" placeholder="请选择班级"></j-select-banji>
              <!--              <j-dict-select-tag-->
              <!--                v-model="queryParam.bjid"-->
              <!--                placeholder="请选择班级"-->
              <!--                dictCode="edu_dev_open.ve_jw_bjgg,name,id"-->
              <!--              ></j-dict-select-tag>-->
            </a-form-item>
          </a-col>
          <a-col :xl="7" :lg="11" :md="12" :sm="24">
            <a-form-item label="发布时间">
              <j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.addtime_begin"></j-date>
              <span class="query-group-split-cust"></span>
              <j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.addtime_end"></j-date>
            </a-form-item>
          </a-col>

          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="标题">
              <a-input v-model="queryParam.title" placeholder="请输入标题"></a-input>
            </a-form-item>
          </a-col>

          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="审核状态">
              <j-dict-select-tag v-model="queryParam.verifystatus" placeholder="请选择" dictCode="verifystatus">
              </j-dict-select-tag>
            </a-form-item>
          </a-col>

          <a-col :md="2" :sm="24">
              <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
                <edu-button type="5" @click="searchQuery" icon="search" title="搜索"
                            style="margin-bottom: 0"></edu-button><edu-button type="7" @click="searchReset"
                                                                              icon="delete" title="清除"
                                                                              style="margin-bottom: 0"></edu-button>
              </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator" :md="24" :sm="24" style="margin: 0px 0px 10px 2px">

      <edu-button @click="handleAdd" type="3" icon="plus" title="添加"/>
      <!--      <a-button @click="handleAdd" type="primary" icon="plus">添加</a-button>-->
      <edu-button type="1" @click="searchQuery" icon="sync" title="刷新"></edu-button>
      <edu-button-delete type="7" ref="batchDelBtn" @del="batchDelAction" @click="batchDelConfirm" icon="delete" title="删除"></edu-button-delete>

      <!--      <a-dropdown v-if="selectedRowKeys.length > 0">-->
      <!--        <a-menu slot="overlay">-->
      <!--          <a-menu-item key="1" @click="batchDel">-->
      <!--            <a-icon type="delete"/>-->
      <!--            删除-->
      <!--          </a-menu-item>-->
      <!--        </a-menu>-->
      <!--        <a-button style="margin-left: 8px"> 批量操作-->
      <!--          <a-icon type="down"/>-->
      <!--        </a-button>-->
      <!--      </a-dropdown>-->
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
        selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
          <edu-label-button type="3" v-if="record.verifystatus == 0" title="修改" @click="updateEdit(record)"></edu-label-button>
          <a-divider type="vertical" v-if="record.verifystatus == 0"/>
          <edu-label-button type="2" title="评审" @click="bjggManage(record)" v-if="record.verifyuser == null || record.verifyuser == ''"></edu-label-button>
          <a-divider type="vertical" v-if="record.verifyuser == null || record.verifyuser == '' "/>
          <edu-label-button type="1" @click="checkBjgg(record)" title="查看"></edu-label-button>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <VeJwBjggModal ref="modalForm" @ok="modalFormOk"></VeJwBjggModal>
    <VeJwBjggCheckModal ref="checkModalForm" @ok="modalFormOK"></VeJwBjggCheckModal>
    <VeJwBjggManageModal ref="bjggManageModalForm" @ok="modalFormOk"></VeJwBjggManageModal>
  </a-card>
</template>

<script>
  import { EduListMixin } from '@/mixins/EduListMixin'
  import { getAction } from '@/api/manage'
  import VeJwBjggModal from './modules/VeJwBjggModal'
  import VeJwBjggCheckModal from './modules/VeJwBjggCheckModal'
  import VeJwBjggManageModal from './modules/VeJwBjggManageModal'
  import { formatDate } from '@/utils/util'
  import JSelectBanji from '../../components/kwglbiz/JSelectBanji'

  export default {
    name: 'EduOrderTicketList',
    mixins: [EduListMixin],
    components: {
      JSelectBanji,
      VeJwBjggModal,
      VeJwBjggCheckModal,
      VeJwBjggManageModal
    },
    data() {
      return {
        description: 've_jw_bjgg管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '班级名称',
            align: 'center',
            dataIndex: 'bjmc'
          },
          {
            title: '标题',
            align: 'center',
            dataIndex: 'title'
          },
          {
            title: '发布时间',
            align: 'center',
            dataIndex: 'addtime',
            customRender: function(text) {
              return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
            }
          },
          {
            title: '教师名称',
            align: 'center',
            dataIndex: 'addusername'
          },
          {
            title: '审核状态',
            align: 'center',
            dataIndex: 'verifystatus_dictText'
          },
          {
            title: '审核人',
            align: 'center',
            dataIndex: 'verifyusername'
          },
          {
            title: '审核时间',
            align: 'center',
            dataIndex: 'verifytime',
            customRender: function(text) {
              return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
            }
          },
          // {
          //   title:'班级ID',
          //   align:"center",
          //   dataIndex: 'bjid'
          // },
          // {
          //   title:'内容（大文本ID）',
          //   align:"center",
          //   dataIndex: 'contenttid'
          // },
          // {
          //   title:'发布人',
          //   align:"center",
          //   dataIndex: 'adduser'
          // },
          //
          // {
          //   title:'审核人',
          //   align:"center",
          //   dataIndex: 'verifyuser'
          // },
          // {
          //   title:'未通过原因',
          //   align:"center",
          //   dataIndex: 'verifytid'
          // },
          // {
          //   title:'终端ID',
          //   align:"center",
          //   dataIndex: 'terminalid'
          // },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            width:190,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: '/jxgz/veJwBjgg/list',
          delete: '/jxgz/veJwBjgg/delete',
          deleteBatch: '/jxgz/veJwBjgg/deleteBatch',
          exportXlsUrl: '/jxgz/veJwBjgg/exportXls',
          importExcelUrl: 'jxgz/veJwBjgg/importExcel'
        },
        dictOptions: {},
        isorter: {
          column: 'id',
          order: 'desc'
        }
      }
    },
    computed: {
      importExcelUrl: function() {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    },
    methods: {
      initDictConfig() {
      },
      //我的班级公告-查看我的班级公告
      checkBjgg: function(record) {
        this.$refs.checkModalForm.edit(record)
        this.$refs.checkModalForm.title = '查看班级日志'
        this.$refs.checkModalForm.disableSubmit = false
      },

      //我的班级公告-修改我的班级公告
      updateEdit: function(record) {
        this.$refs.modalForm.edit(record)
        this.$refs.modalForm.title = '编辑班级日志'
        this.$refs.modalForm.disableSubmit = false
      },

      handleAdd: function() {
        this.$refs.modalForm.add()
        this.$refs.modalForm.title = '新增班级公告'
        this.$refs.modalForm.disableSubmit = false
      },
      //班级公告管理-评审
      bjggManage: function(record) {
        this.$refs.bjggManageModalForm.edit(record)
        this.$refs.bjggManageModalForm.title = '评审班级日志'
        this.$refs.bjggManageModalForm.disableSubmit = false
      }

    }
  }
</script>
<style scoped>
  @import '~@assets/less/usercolor.less'
</style>